import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import { anim, play, combine } from '@feidao/animation';
import { ICombineAnimation } from '@feidao/animation/types';

export default async function a001(fd: IFeidaoAiBrowserComponent, ...args: any[]) {

	const right = document.getElementById('right')

	let anim1: ICombineAnimation;
	console.log(fd.data);

	if (fd.data.params['left']) {
		const left = document.getElementById('left');
		const left_open = document.getElementById('left_open');
		const left_close = document.getElementById('left_close');

		const narrow = 70;
		const wide = 165;
		const a1 = anim(left, {
		}, {
				width: {
					start: wide,
					end: narrow
				}
			});
		const a2 = anim(right, {
		}, {
				'margin-left': {
					start: wide,
					end: narrow
				}
			});
		anim1 = combine([a1, a2], {
			play() {
				left_open.style.display = 'none';
				left_close.style.display = 'block';
			}
		});
		play(anim1);

	}
}
